package com.jeeplus.modules.CodeDemo.web;

import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.common.json.ReturnJson;
import com.jeeplus.common.utils.ResponseCode;
import com.jeeplus.core.web.BaseController;
import com.jeeplus.modules.sys.utils.MessageUtil;
import com.jeeplus.modules.test.one.dialog.entity.Leave1;
import com.jeeplus.modules.tools.utils.MultiDBUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 * @title: DemoController
 * @projectName JeePlus
 * @description: TODO
 * @date 2019/11/614:31
 */
@Controller
@RequestMapping(value = "/demo")
public class DemoController extends BaseController {
    //region 视图功能
    @RequestMapping(value = {"", "demo"})
    public String demo(Leave1 leave1, Model model) {
        model.addAttribute("leave1", leave1);
        return "modules/CodeDemo/demo";
    }
    @RequestMapping(value = {"", "GetList"})
    @ResponseBody
    public ReturnJson GetList(String moduleId){
        String sql="select t.F_Id,\n" +
                "       t.F_Name,\n" +
                "       t.F_ModuleId,\n" +
                "       t.F_ModuleBtnId,\n" +
                "       t.F_BtnName,\n" +
                "       t.F_DbId,\n" +
                "       t.F_DbTable,\n" +
                "       t.F_ErrorType,\n" +
                "       t.F_EnabledMark,\n" +
                "       t.F_Description,\n" +
                "       t.F_CreateDate,\n" +
                "       t.F_CreateUserId,\n" +
                "       t.F_CreateUserName,\n" +
                "       t.F_ModifyDate,\n" +
                "       t.F_ModifyUserId,\n" +
                "       t.F_ModifyUserName\n" +
                "\n" +
                "  FROM LR_Excel_Import t\n" +
                " where t.F_ModuleId = 'b6d49d56-565c-4a99-a3e2-b80c92dd702f'\n" +
                "   AND t.F_EnabledMark = 1";
        List<Map<String,Object>> list= MultiDBUtils.get("qixindb").queryList(sql,null);
        System.out.println(list);
        ReturnJson ajaxJson=new ReturnJson();
        ajaxJson.setCode(new ResponseCode().success);
        ajaxJson.setData(list);
        return ajaxJson;
    }

    //endregion
}
